package com.example.app12_data_storage;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

import com.example.app12_data_storage.activity.InnerFileActivity;
import com.example.app12_data_storage.activity.NetworkActivity;
import com.example.app12_data_storage.activity.SdcardActivity;
import com.example.app12_data_storage.activity.SpActivity;
import com.example.app12_data_storage.activity.SqliteActivity;

public class MainActivity extends AppCompatActivity {

    private static final String TAG = "MainActivity";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        Log.i(TAG, "onCreate()");
        super.onCreate(savedInstanceState);
        EdgeToEdge.enable(this);
        setContentView(R.layout.activity_main);
        ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
            Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
            v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
            return insets;
        });
    }

    /**
     * SharePreference 存储
     * @param view 发生点击事件的视图对象
     */
    public void onClickSp(View view) {
        startActivity(new Intent(this, SpActivity.class));
    }

    /**
     * 内部文件存储
     * @param view 发生点击事件的视图对象
     */
    public void onClickInnerFile(View view) {
        startActivity(new Intent(this, InnerFileActivity.class));
    }

    /**
     * 外部文件存储
     * @param view 发生点击事件的视图对象
     */
    public void onClickOuterFile(View view) {
        startActivity(new Intent(this, SdcardActivity.class));
    }

    /**
     * Sqlite 数据库存储
     * @param view 发生点击事件的视图对象
     */
    public void onClickSqlite(View view) {
        startActivity(new Intent(this, SqliteActivity.class));
    }

    /**
     * 网络存储
     * @param view 发生点击事件的视图对象
     */
    public void onClickNetwork(View view) {
        startActivity(new Intent(this, NetworkActivity.class));
    }
}